<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">

<head th:replace="common/head::head"></head>

<body class="layui-layout-body">

<div class="layui-layout layui-layout-admin" th:if="${installed}">
    <div class="layui-header">
        <div class="layui-logo">
            <a href="../index.html" style="color: #009688;">Jpom项目管理系统>> </a>
            <span th:title="'版本时间:'+${jpomManifest.timeStamp}+'，进程ID:'+${jpomManifest.pid}">
                [[${node.name}]]<span style="font-size: 10px;"
                                      th:text="'('+${jpomManifest.version}+')'"></span>
            </span>
        </div>
        <div th:replace="common/userHead::userHead"></div>
    </div>
    <div th:replace="common/indexMenus::indexMenus"></div>
</div>
<div th:unless="${installed}">
    <div class="layui-carousel" id="div-carousel" style="width: 100%; height: 100%; position: fixed; z-index: 0;">
        <div carousel-item>
            <div><img th:src="@{${session.jpomProxyPath}+'/static/backgrounds/1.jpg?v='+${session.staticCacheTime}}"
                      style="width: 100%;"></div>
        </div>
    </div>
    <div class="layui-container" style="margin-top: 150px;">
        <div class="layui-row">
            <div class="layui-col-md4 layui-col-md-offset4">
                <form class="layui-form" method="post" action="">
                    <div class="layui-form-item" style="color: #FFF; font-size: 24px;text-align: center;">
                        <span th:text="'初始化节点（'+${node.name}+'）'"></span>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block" style="margin-left: 0px;">
                                <textarea name="project" lay-verify="required"
                                          placeholder="请输入项目存放路径白名单，回车支持输入多个路径"
                                          class="layui-textarea"></textarea>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block" style="margin-left: 0px;">
                            <button class="layui-btn layui-btn-danger" lay-submit lay-filter="from_node"
                                    style="width: 100%">确定
                            </button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript" th:unless="${installed}">
    asyncFn.push(function () {
        layui.use(['carousel'], function () {
            var carousel = layui.carousel;
            carousel.render({
                elem: '#div-carousel',
                width: '100%',
                height: '100%',
                anim: 'fade',
                arrow: 'none',
                indicator: 'none'
            });
            //
            form.on('submit(from_node)', function (data) {
                loadingAjax({
                    url: './install_node.json',
                    data: data.field,
                    success: function (data) {
                        layer.msg(data.msg);
                        if (200 == data.code) {
                            setTimeout(function () {
                                window.location.reload();
                            }, 1500);
                        }
                    }
                });
                return false;
            });
        });
    })
</script>
<script type="text/javascript">
    function loadSuccess() {
        if ("[[${tipUpdate}]]" === "true")
            layer.alert("当前节点和服务端版本不一致，请检查更新");
    }
</script>

</html>
